﻿using GGetTestService.Enums;
using GGetTestService.Extension;
using System;
using Test.Util;

namespace GGetTestService.Dto.Student
{
    //public class StudentSearchDto
    //{
    //    public OperatorValuePair<string> Name { get; set; }

    //    public OperatorValuePair<int> Age { get; set; }
    //}

    /// <summary>
    /// 学生查询类
    /// </summary>
    public class StudentSearchDto
    {
        [Search(SearchColumnName = "Name", SearchOperator = OperatorEnum.Equal)]
        public string Name { get; set; }

        [Search(SearchColumnName = "Age", SearchOperator = OperatorEnum.GreaterThan)]
        public int Age { get; set; }

        [Search(SearchColumnName = "TeacherId", SearchOperator = OperatorEnum.Equal)]
        public Guid? TeacherId { get; set; }
    }

    public class StudentSearchModel
    {
        [Search1("Name", OperationType.Equal)]
        public string Name { get; set; }

        [Search1("Age", OperationType.LessThan)]
        public int Age { get; set; }

        [Search1("TeacherId",OperationType.Equal)]
        public Guid TeacherId { get; set; }

    }

    /// <summary>
    /// 运算符、值键值对
    /// </summary>
    public class OperatorValuePair<TEntiyType>
    {
        /// <summary>
        /// 值
        /// </summary>
        public TEntiyType Value { get; set; }

        /// <summary>
        /// 比较符号
        /// </summary>
        public OperatorEnum Operator { get; set; } = OperatorEnum.Equal;
    }
}